PROJECT(GStreamerPlugin)

INCLUDE(${QT_USE_FILE})
INCLUDE(UsePkgConfig)

PKGCONFIG(libxml-2.0 LIBXML_INCLUDE_DIR LIBXML_LIB_DIR LIBXML_LD_FLAGS LIBXML_CPP_FLAGS)
IF(DEFINED LIBXML_INCLUDE_DIR)
	MESSAGE("-- Found libxml2")
ELSE(DEFINED LIBXML_INCLUDE_DIR)
	MESSAGE(FATAL_ERROR "libxml2 Not found! You need to fix this!")
ENDIF(DEFINED LIBXML_INCLUDE_DIR)

PKGCONFIG(glib-2.0 GLIB_INCLUDE_DIR GLIB_LIB_DIR GLIB_LD_FLAGS GLIB_CPP_FLAGS)
IF(DEFINED GLIB_INCLUDE_DIR)
	MESSAGE("-- Found glib 2.0")
ELSE(DEFINED GLIB_INCLUDE_DIR)
	MESSAGE(FATAL_ERROR "glib 2.0 Not found! You need to fix this!")
ENDIF(DEFINED GLIB_INCLUDE_DIR)

PKGCONFIG(gstreamer-0.10 GST_INCLUDE_DIR GST_LIB_DIR GST_LD_FLAGS GST_CPP_FLAGS)
IF(DEFINED GST_INCLUDE_DIR)
	MESSAGE("-- Found gstreamer 0.10")
ELSE(DEFINED GST_INCLUDE_DIR)
	MESSAGE(FATAL_ERROR "gstreamer 0.10 Not found! You need to fix this!")
ENDIF(DEFINED GST_INCLUDE_DIR)

INCLUDE_DIRECTORIES(${LIBXML_INCLUDE_DIR} ${GLIB_INCLUDE_DIR} ${GST_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/core/interfaces)

ADD_DEFINITIONS(-DQT_PLUGIN -DQT_SHARED)
ADD_DEFINITIONS(${LIBXML_CPP_FLAGS} ${GLIB_CPP_FLAGS} ${XINE_CPP_FLAGS})

SET(GStreamerPlugin_SRCS
    gstreamerplugin.cpp
)

SET(GStreamerPlugin_HDRS
	gstreamerplugin.h
)

QT4_WRAP_CPP(GStreamerPlugin_SRCS ${GStreamerPlugin_HDRS})

ADD_LIBRARY(utopiaplayer_gstreamer_plugin SHARED ${GStreamerPlugin_SRCS})

TARGET_LINK_LIBRARIES(utopiaplayer_gstreamer_plugin ${QT_LIBRARIES} ${LIBXML_LD_FLAGS} ${GLIB_LD_FLAGS} ${GST_LD_FLAGS})

INSTALL(TARGETS utopiaplayer_gstreamer_plugin DESTINATION share/utopiaplayer/plugins/output)
